package reader_;

import org.junit.Test;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class BufferedReader_ {
    public static void main(String[] args) {

    }
    @Test
    public void bufferedReader01(){
        //用buffered读取文件
        BufferedReader bufferedReader = null;
        //接收字符串
        String line;
        try {
            bufferedReader = new BufferedReader(new FileReader("D:\\xuexi\\str1.txt"));
            while ((line=bufferedReader.readLine())!=null){
                System.out.println(line);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                bufferedReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
